package com.qianxx.component.activity.effects.scroll_panel.fragment;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.qianxx.component.R;

import java.util.ArrayList;
import java.util.List;

public class LeftAdapter extends RecyclerView.Adapter<LeftAdapter.MealHolder> {
    private List<String> list = new ArrayList<>();
    private Context context;

    public LeftAdapter(Context context, List<String> list) {
        this.context = context;
        this.list = list;
    }

    @Override
    public MealHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new MealHolder(LayoutInflater.from(context).inflate(R.layout.item_left, null));
    }

    @Override
    public void onBindViewHolder(MealHolder holder, int position) {
        holder.tv.setText(list.get(position));
    }

    @Override
    public int getItemCount() {
        return list.size();
    }

    class MealHolder extends RecyclerView.ViewHolder {
        private TextView tv;

        public MealHolder(View itemView) {
            super(itemView);
            tv = itemView.findViewById(R.id.tv);
        }
    }
}
